/**
 * 
 */
package net.mikoo.seals.agent.biz.services.impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.mikoo.seals.agent.biz.mapper.agent.PersonMapper;
import net.mikoo.seals.agent.biz.services.PersonServices;
import net.mikoo.seals.agent.common.exception.ParametersException;
import net.mikoo.seals.agent.model.Person;

/**
 * @author huangxm
 *
 */
@Service
public class PersonServicesImpl implements PersonServices {

	Logger logger = Logger.getLogger(PersonServicesImpl.class);

	@Autowired
	private PersonMapper personMapper;

	@Override
	public Person loadByPrimaryKey(String userLoginId) {
		
		Person person = personMapper.selectByPrimaryKey(userLoginId);

		return person;
	}

	@Override
	public Person modifyByPrimaryKey(Person person) {
		
		personMapper.updateByPrimaryKey(person);

		return person;
	}

	@Override
	public void deleteByPartyId(Long partyId) {
		if (partyId == null) {
			throw new ParametersException("partyId is null!");
		}
		personMapper.deleteByPartyId(partyId);

	}

}
